<%--
/**
* Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@page import="com.hotel.test.service.LocalLocalServiceUtil"%>
<%@page import="com.hotel.test.service.HotelLocalServiceUtil"%>
<%@ include file="/html/init.jsp" %>
<%

	 String url = PortalUtil.getCurrentURL(request);
PortletSession s = renderRequest.getPortletSession(true);
	String localIdString = (String)s.getAttribute("localId", PortletSession.APPLICATION_SCOPE);
		List<Local> locals = null;
	
		
		locals = LocalLocalServiceUtil.getAll();
	
	
	if(locals.isEmpty())
	{
		%>
		<h1>Khong co khach san nao duoc tim thay</h1>
		<%
	}
	else
	{
		
		%>
		<table >
				<%
					int i = 0; 
					int size = locals.size();
					while(i<(size/4))
					{
						%>
							<tr>
							<%
							for(int j = 0 ; j<4; j++ )
							{
								%>
									<td class="img">
								
									<a href="<%=url+"?localId="+locals.get(i+j).getLocalId()%>"><img width="100px" height="100px" src="<%=locals.get(i+j).getImage()%>"/></a>
									<div class="desc">
									<a href="<%=url+"?localId="+locals.get(i+j).getLocalId()%>"><%=locals.get(i+j).getLocalName() %></a> 
									</div>	
								</td>
								<%
							}
							
							%>
							</tr>
						<%
						i+=4;
					}
					if((size%4)>0)
					{
						%>
						<tr>
						<%
							for(int j = 0 ; j<size%4; j++)
							{
								%>
								<td class="img">
								
									<a href="<%=url+"?localId="+locals.get(i+j).getLocalId()%>"><img width="100px" height="100px" src="<%=locals.get(i+j).getImage()%>"/></a>
									<div class="desc">
									<a href="<%=url+"?localId="+locals.get(i+j).getLocalId()%>"><%=locals.get(i+j).getLocalName() %></a> 
									</div>	
								</td>
								<% 
							}
						%>
						</tr>
						<%
					}
				%>
			</table>
		
		<%
		
		
	}
	
%>
